import React from 'react'
import styles from '../css/list.module.css'
import { useNavigate, useSearchParams } from 'react-router-dom'
const Ticketiltem = (props) => {
 const nav=useNavigate()
 const [sp]=useSearchParams()


  const gotoDeail=()=>{
   nav(`/deail/${props.id}?
    start=${props.startStation}
    &end=${props.endStation}&date=${sp.get('date')}`)
  }
  return (
    <div className={styles.ticketiltemBox}
     onClick={gotoDeail}
    >
    <span className={styles.sp1}>发车 {props.startStation}</span>
    <span className={styles.sp2}>{props.endStation}</span>
    <span className={styles.sp3}>{props.trainNo}</span>
    <span className={styles.sp4}>￥ {props.ssoftSeat.price}</span>

    <span className={styles.sp5}>到达 {props.startTime}</span>
    <span className={styles.sp6}>{props.endTime}</span>
    <span className={styles.sp7}>耗时{props.timeTaken}</span>
    <span className={styles.sp8}>二等座: {props.ssoftSeat.ticketNum}
     {typeof props.ssoftSeat.ticketNum === 'number' ? '张' : ''}
    </span>
      
    </div>
  )
}

export default Ticketiltem


